
import java.io.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Stack;
import java.util.Random;
import java.lang.Math;
import java.lang.String;

class Deck{
private Stack deck;
	
	public Deck(){
		deck = new Stack();
	}
	
	public void shuffleDeck(){
		ArrayList<Card> tempDeck = new ArrayList<Card>();
		Stack s = new Stack();
		int count = 0;
		int cardnum;
		
		// initialize a deck to choose cards from
		for(cardnum = 1; cardnum<14; cardnum++){
			tempDeck.add(new Card(cardnum, 'd'));
			tempDeck.add(new Card(cardnum, 's'));
			tempDeck.add(new Card(cardnum, 'h'));
			tempDeck.add(new Card(cardnum, 'c'));
		}
	
		Random gen = new Random();
		int randIndex;
		// randomly chooose cards from tempDeck
		while(tempDeck.size() > 0){
			randIndex = gen.nextInt(tempDeck.size());
			s.push(tempDeck.remove(randIndex));
		}
		
		deck = s;			
	}
	
	public Card getNextCard(){
		return (Card)deck.pop();
	}
	
	public boolean isDeckEmpty(){
		return deck.isEmpty();
	}
}
